package com.liang.socketdemo3;

import java.io.IOException;
import java.io.InputStream;
import java.net.ServerSocket;
import java.net.Socket;

public class ServerDemo {
    public static void main(String[] args) throws IOException {

        //创建服务器端套接字
        ServerSocket ss = new ServerSocket(10000);

        //拿到客户端的信息，创建客服端对象
        Socket accept = ss.accept();

        //等待接受到客户端发送过来的信息
        InputStream is = accept.getInputStream();

        int b;
        while ((b = is.read()) != -1) {
            System.out.print((char)b);
        }

        //关闭资源
        accept.close();
        ss.close();
    }
}
